package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Phenologicalguidance;
import com.ruoyi.system.service.IPhenologicalguidanceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 标准化生产指导管理Controller
 * 
 * @author ruoyi
 * @date 2025-07-25
 */
@RestController
@RequestMapping("/system/phenologicalguidance")
public class PhenologicalguidanceController extends BaseController
{
    @Autowired
    private IPhenologicalguidanceService phenologicalguidanceService;

    /**
     * 查询标准化生产指导管理列表
     */

    @GetMapping("/list")
    public TableDataInfo list(Phenologicalguidance phenologicalguidance)
    {
        startPage();
        List<Phenologicalguidance> list = phenologicalguidanceService.selectPhenologicalguidanceList(phenologicalguidance);
        return getDataTable(list);
    }

    /**
     * 导出标准化生产指导管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:phenologicalguidance:export')")
    @Log(title = "标准化生产指导管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Phenologicalguidance phenologicalguidance)
    {
        List<Phenologicalguidance> list = phenologicalguidanceService.selectPhenologicalguidanceList(phenologicalguidance);
        ExcelUtil<Phenologicalguidance> util = new ExcelUtil<Phenologicalguidance>(Phenologicalguidance.class);
        util.exportExcel(response, list, "标准化生产指导管理数据");
    }

    /**
     * 获取标准化生产指导管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:phenologicalguidance:query')")
    @GetMapping(value = "/{guidanceid}")
    public AjaxResult getInfo(@PathVariable("guidanceid") Long guidanceid)
    {
        return success(phenologicalguidanceService.selectPhenologicalguidanceByGuidanceid(guidanceid));
    }

    /**
     * 新增标准化生产指导管理
     */

    @Log(title = "标准化生产指导管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Phenologicalguidance phenologicalguidance)
    {
        return toAjax(phenologicalguidanceService.insertPhenologicalguidance(phenologicalguidance));
    }

    /**
     * 修改标准化生产指导管理
     */

    @Log(title = "标准化生产指导管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Phenologicalguidance phenologicalguidance)
    {
        return toAjax(phenologicalguidanceService.updatePhenologicalguidance(phenologicalguidance));
    }

    /**
     * 删除标准化生产指导管理
     */

    @Log(title = "标准化生产指导管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guidanceids}")
    public AjaxResult remove(@PathVariable Long[] guidanceids)
    {
        return toAjax(phenologicalguidanceService.deletePhenologicalguidanceByGuidanceids(guidanceids));
    }



}
